<?php

require 'adodb/adodb.inc.php';
require_once 'inc.config.php';
require_once 'inc.utils.php';

class DbConnectionFestival {

    private $DB;

    function __construct() {
        $this->DB = NewADOConnection(DB_ENGINE);
        $this->DB->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
    }


    function executeQueryReturnArray($query){
        $rs = $this->DB->Execute($query);
        while (!$rs->EOF) {
            $arr[] = $rs->fields;
            $rs->MoveNext();
        }
        return $arr;
    }

    function executeQueryReturnStringArray($query){
        $rs = $this->DB->Execute($query);
        while (!$rs->EOF) {
            foreach($rs->fields as $id=>$ella){
                if(!is_int($id)){
                    $temp[$id]=$ella;
                }
            }
            $arr[] = $temp;
            $rs->MoveNext();
        }
        return $arr;
    }

    function executeQueryReturnResultset($query){
        return $this->DB->Execute($query);
    }
}
?>
